/*
 * VyzivaciListener.java
 *
 * Created on 24.11.2007, 0:53:23
 *
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cz.possoft.client.gui.dialog;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;

import cz.possoft.client.gui.panel.nastavenispodnipanel.panel.NastaveniShowPanel;

/**
 *
 * @author mara
 * 
 * Listener vyvolan pri stisku tlacitka VYZVAT
 */
public class VyzivaciListener implements ActionListener {

    public void actionPerformed(ActionEvent ae) {
        String selectedUser = (String) NastaveniShowPanel.getListOfUsers().getSelectedValue();
        if (selectedUser != null) {
            int indexOfFontCloseTag = selectedUser.indexOf("</FONT>");
            // 32 je index konce tagu FONT ,takze tady zacina jmeno uzivatele.
            // dost prasacky kod :-)
            String userName = selectedUser.substring(32, indexOfFontCloseTag);
            NastaveniShowPanel.getConnectThread().vyzvat(userName);
            ((JButton) ae.getSource()).setEnabled(false);
        }
    }
}
